<?php

namespace App\Listeners;

use App\Events\PlayerMoneyChangeEvent;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use App\Models\PlayerMoneyLog;

class PlayerMoneyChangeListener
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  PlayerMoneyChangeEvent  $event
     * @return void
     */
    public function handle(PlayerMoneyChangeEvent $event)
    {
        $arr = [];
        $arr['order_no'] = $event->order_no;
        $arr['user_id'] = $event->user_id;
        $arr['server_id'] = $event->server_id;
        $arr['player_id'] = $event->player_id;
        $arr['goods_id'] = $event->goods_id;
        $arr['type'] = $event->type;
        $arr['trade_type'] = $event->trade_type;
        $arr['amount'] = $event->amount;
        $arr['cash_fee'] = $event->cash_fee;
        $arr['after_money'] = $event->after_money;
        $arr['info'] = $event->info;
        PlayerMoneyLog::create($arr);
    }
}
